package com.example.big_event.config;

import com.example.big_event.interceptor.Logininterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@Configuration//配置类注入到IOC容器中
public class WebConfig implements WebMvcConfigurer {

    @Autowired//注解注入拦截器的类
    private Logininterceptor logininterceptor;

    @Override//重写addInterceptors方法
    public void addInterceptors(InterceptorRegistry registry) {

                                  //拦截器对象注册进去 ---登录和注册接口不拦截
        registry.addInterceptor(logininterceptor).excludePathPatterns("/user/login","/user/register");

    }
}
